class Photo < ActiveRecord::Base
  belongs_to :album
  belongs_to :author,
    :class_name => "Valleyer",
    :foreign_key => "author_id"

  has_many :post_sessions,
    :order => "created_at desc"

  acts_as_fleximage :image_directory => 'public/uploads/photos'
  use_creation_date_based_directories true
  image_storage_format :jpg
  require_image true
  missing_image_message '必须指定'
  invalid_image_message '不是一个有效的图片文件'
  output_image_jpg_quality  100
  preprocess_image do |image|
    image.resize '800x600'
  end
end
